package com.program.test111;

import com.program.model.entity.User;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

public class DeserializeExample {
    public static void main(String[] args) {
        try (FileInputStream fileIn = new FileInputStream("user.ser");
             ObjectInputStream in = new ObjectInputStream(fileIn)) {
            User user = (User) in.readObject();
            System.out.println("Deserialized User:");
            System.out.println("Username: " + user.getUserName());
            System.out.println("Email: " + user.getEmail());
        } catch (IOException | ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}